package com.meisupic.copyright.domain.vo;

import static com.meisupic.copyright.common.Constants.CERTIFICATE_FILE_PATH;
import static com.meisupic.copyright.common.Constants.OSS_HOST;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.meisupic.copyright.common.WorksProcessDetailEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @Author lanjian
 * @Date 2018/9/3 下午3:24
 */
@ApiModel
@Data
public class CopyrightWorksResultApiVo implements Serializable {

  @ApiModelProperty(value = "登记作品id")
  private Long id;

  @ApiModelProperty(value = "作品全称")
  private String worksFullName;

  @ApiModelProperty(value = "作品类型")
  private String worksType;

  @ApiModelProperty(value = "作者名称")
  private String author;

  @ApiModelProperty(value = "创作完成国家")
  private String creationCountry;

  @ApiModelProperty(value = "创作完成省份")
  private String creationProvince;

  @ApiModelProperty(value = "创作完成城市")
  private String creationCity;

  @ApiModelProperty(value = "创作完成日期")
  @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  private Date creationDate;

  @ApiModelProperty(value = "发表状态")
  private Integer publishStatus;

  @ApiModelProperty(value = "首次发表国家")
  private String firstPublishCountry;

  @ApiModelProperty(value = "首次发表省份")
  private String firstPublishProvince;

  @ApiModelProperty(value = "首次发表城市")
  private String firstPublishCity;

  @ApiModelProperty(value = "首次发表日期")
  @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  private Date firstPublishDate;

  /**
   * 作品主要特点
   */
  @ApiModelProperty(value = "作品主要特点")
  private String mainFeatures;

  /**
   * 权利归属方式
   */
  @ApiModelProperty(value = "权利归属方式")
  private Integer rightOwnMode;

  /**
   * 权利取得方式
   */
  @ApiModelProperty(value = "权利取得方式")
  private Integer rightFetchMode;

  /**
   * 创作性质
   */
  @ApiModelProperty(value = "创作性质")
  private Integer creativeNature;

  /**
   * dci码
   */
  @ApiModelProperty(value = "作品dci码")
  private String dciCode;

  @ApiModelProperty(value = "dci信息查询地址")
  private String dciUrl;

  @ApiModelProperty(value = "dci证书下载地址，开发人员可下载保存到服务器")
  private String certFileName;

  /**
   * 证书公布时间
   */
  @ApiModelProperty(value = "证书颁发时间")
  private Date promulgateDate;

  /**
   * 审核详细状态
   */
  private WorksProcessDetailEnum worksProcessDetail;

  private String worksProcessDetailDesc;

  public String getWorksProcessDetailDesc() {
    return this.getWorksProcessDetail().getDesc();
  }

  public String getCertFileName() {
    return StringUtils.isEmpty(certFileName) ? certFileName
        : OSS_HOST + CERTIFICATE_FILE_PATH + certFileName;
  }
}
